package velox.jcr.mapper;


/**
 * The UnitOfWork keeps track of all entities used during a session
 * to enable referential integrity. All operations must be registered
 * by the UnitOfWork. 
 *
 * The UnitOfWork is responsible for populating the SecondLevelCache and
 * also to invalidate it when the underlying repository is changed.
 * 
 * @see SecondLevelCache
 */
public interface UnitOfWork {

	public void registerLoad(String key, Object obj, Mapper<?> mapper);

	public void registerPersist(String key, Object obj);

	public void registerUpdate(String key, Object obj);

	public void registerRemove(String key);

	public <T> T get(String key, Mapper<T> mapper);

	public SecondLevelCache getSecondLevelCache();
	
	public MapperManager getMapperManager();
	
	public Filter getFilter();
	public void setFilter(Filter filter);
}